﻿
@{
    ViewBag.Title = "修改密码";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}

<div class="main-wrap">

    <div class="crumb-wrap">
        <div class="crumb-list"><i class="icon-font"></i><a href="@(Url.Action("Index","Home"))">首页</a><span class="crumb-step">&gt;</span><span>修改密码</span></div>
    </div>
    <div class="result-wrap">
        <div class="result-content">
            <form action="@(Url.Action("ChangePasword"))" method="post">
                <table class="insert-table" width="100%">
                    <tbody>
                        <tr>
                            <th>显示友好时间：</th>
                            <td>
                                <input class="common-text required" id="password" name="password" size="50" type="password">
                            </td>
                        </tr>   
                        <tr>
                            <th>新密码：</th>
                            <td>
                                <input class="common-text required" id="newpassword" name="newpassword" size="50" type="password">
                            </td>
                        </tr>
                        <tr>
                            <th>新密码确认：</th>
                            <td><input class="common-text required" id="newpassword2" name="newpassword2" size="50" type="password"></td>
                        </tr>
                        <tr>
                            <th></th>
                            <td>
                                <input class="btn btn-primary btn6 mr10" value="提交" type="button" id="btnSubmit">
                                <input class="btn btn6" onclick="history.go(-1)" value="返回" type="button">
                            </td>
                        </tr>
                    </tbody>
                </table>
            </form>
        </div>
    </div>
</div>

<script>
    $(function () {
        $(document).on('click', '#btnSubmit', function () {
            $.ajax({
                type: "POST",
                url: "@(Url.Action("ChangePasword"))",
                data: $("form").serialize(),
                success: function (result) {
                    if (result.status) {
                        $("form")[0].reset();
                        layer.msg('修改成功！', { icon: 1 });
                    } else {
                        var error = result.errorMessage;
                        if (result.data) {
                            error += "<br>" + result.data;
                        }
                        layer.alert(error, { icon: 5 });
                    }
                }
            });
        });
    });
</script>
